/* Toolbar Component Styles */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-toolbar-bg);
  border-bottom: 1px solid var(--color-border-primary);
  min-height: 60px;
  flex-shrink: 0;
}

.toolbarLeft {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  color: var(--color-toolbar-text);
  font-size: 18px;
}

.logoIcon {
  font-size: 24px;
  line-height: 1;
}

.logoText {
  font-weight: 700;
  letter-spacing: -0.025em;
}

.projectInfo {
  display: flex;
  align-items: center;
  margin-left: var(--spacing-md);
}

.projectBadge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-secondary);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  user-select: none;
  transition: all var(--transition-fast);
}

.projectBadge:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-primary);
}

.projectIcon {
  opacity: 0.7;
  color: var(--color-primary);
}

.projectLabel {
  font-weight: 500;
  color: var(--color-text-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.projectName {
  color: var(--color-text-primary);
  font-weight: 500;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 移动端响应式 */
@media (max-width: 768px) {
  .projectBadge {
    padding: 3px 10px;
    font-size: 11px;
    gap: 4px;
  }
  
  .projectName {
    max-width: 100px;
  }
  
  .projectLabel {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .projectInfo {
    display: none; /* 在小屏幕上隐藏项目名 */
  }
}

.toolbarCenter {
  display: flex;
  align-items: center;
}

.controlGroup {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.controlBtn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-lg);
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-toolbar-text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
  position: relative;
  overflow: hidden;
}

.controlBtn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.controlBtn:active {
  transform: translateY(0);
}

.controlBtnSave {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: rgba(255, 255, 255, 0.2);
}

.controlBtnSave:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: var(--shadow-md);
}

.controlBtnRun {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: rgba(255, 255, 255, 0.2);
}

.controlBtnRun:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: var(--shadow-md);
}

.controlBtnStop {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: rgba(255, 255, 255, 0.2);
  position: relative;
}

.controlBtnStop:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: var(--shadow-md);
}

.controlBtnStop::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #ef4444, #f97316, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ef4444);
  border-radius: var(--border-radius-lg);
  z-index: -1;
  animation: rainbow 2s linear infinite;
  background-size: 400% 400%;
}

@keyframes rainbow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.toolbarRight {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  position: relative;
}

.desktopButtons {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.mobileMenu {
  display: none;
  position: relative;
}

.iconBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-toolbar-icon);
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
}

.iconBtn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-toolbar-icon-hover);
  transform: translateY(-1px);
}

.iconBtn svg {
  transition: all var(--transition-normal);
  pointer-events: none;
}

.iconBtn:hover svg {
  transform: rotate(15deg);
}

/* 移动端菜单样式 */
.moreBtn {
  position: relative;
}

.moreBtn.active {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-primary);
}

.mobileMenuDropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: auto;
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}

.mobileMenuItem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.6);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--border-radius-sm);
}

.mobileMenuItem:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
  color: rgba(0, 0, 0, 0.8);
}

.mobileMenuItem:active {
  transform: translateY(0);
  background: rgba(0, 0, 0, 0.1);
}

.mobileMenuItem svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.mobileMenuItem:hover svg {
  transform: scale(1.1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 暗色主题适配 */
[data-theme="dark"] .mobileMenuDropdown {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mobileMenuItem {
  color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .mobileMenuItem:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .mobileMenuItem:active {
  background: rgba(255, 255, 255, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .toolbar {
    padding: var(--spacing-sm) var(--spacing-md);
    min-height: 52px;
  }
  
  .logo {
    font-size: 16px;
  }
  
  .logoIcon {
    font-size: 20px;
  }
  
  .controlBtn {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 13px;
  }
  
  .iconBtn {
    width: 32px;
    height: 32px;
  }
  
  .iconBtn svg {
    width: 14px;
    height: 14px;
  }
  
  /* 移动端显示省略菜单，隐藏桌面端按钮 */
  .desktopButtons {
    display: none;
  }
  
  .mobileMenu {
    display: block;
  }
}

@media (max-width: 480px) {
  .toolbar {
    padding: var(--spacing-xs) var(--spacing-sm);
    min-height: 48px;
  }
  
  .logo {
    font-size: 14px;
  }
  
  .logoIcon {
    font-size: 18px;
  }
  
  .controlBtn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 12px;
    gap: var(--spacing-xs);
  }
  
  .iconBtn {
    width: 28px;
    height: 28px;
  }
  
  .iconBtn svg {
    width: 12px;
    height: 12px;
  }
}
